/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mysweethome.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author BKC
 */
@Entity
@Table(name = "PropertyImage", catalog = "MySweetHomeDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "PropertyImage.findAll", query = "SELECT p FROM PropertyImage p"),
    @NamedQuery(name = "PropertyImage.findByImageID", query = "SELECT p FROM PropertyImage p WHERE p.imageID = :imageID"),
    @NamedQuery(name = "PropertyImage.findByImageName", query = "SELECT p FROM PropertyImage p WHERE p.imageName = :imageName")})
public class PropertyImage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ImageID")
    private Integer imageID;
    @Basic(optional = false)
    @Column(name = "ImageName")
    private String imageName;
    @JoinColumn(name = "ProperyInfoID", referencedColumnName = "PropertyInfoID")
    @ManyToOne(optional = false)
    private DetailPropertyInfo detailPropertyInfo;

    public PropertyImage() {
    }

    public PropertyImage(Integer imageID) {
        this.imageID = imageID;
    }

    public PropertyImage(Integer imageID, String imageName) {
        this.imageID = imageID;
        this.imageName = imageName;
    }

    public Integer getImageID() {
        return imageID;
    }

    public void setImageID(Integer imageID) {
        this.imageID = imageID;
    }

    public String getImageName() {
        return imageName;
    }

    public void setImageName(String imageName) {
        this.imageName = imageName;
    }

    public DetailPropertyInfo getDetailPropertyInfo() {
        return detailPropertyInfo;
    }

    public void setDetailPropertyInfo(DetailPropertyInfo detailPropertyInfo) {
        this.detailPropertyInfo = detailPropertyInfo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (imageID != null ? imageID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PropertyImage)) {
            return false;
        }
        PropertyImage other = (PropertyImage) object;
        if ((this.imageID == null && other.imageID != null) || (this.imageID != null && !this.imageID.equals(other.imageID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mysweethome.entities.PropertyImage[imageID=" + imageID + "]";
    }

}
